import 'package:flutter/material.dart';
import 'package:ytbusiness/config/style.dart';
import 'package:ytbusiness/page/auto_makers/shop_home/order_details/order_info.dart';
import 'package:ytbusiness/page/auto_makers/shop_home/order_widget/enquiry_item.dart';
import 'package:ytbusiness/utils/screen_adaptation.dart';
import 'package:ytbusiness/widgets/widgets.dart';
//已取消
class Canceled extends StatefulWidget {
  @override
  _CanceledState createState() => _CanceledState();
}

class _CanceledState extends State<Canceled> {
  List<String> typeList = ["原厂原包", "品牌", "拆车", "OEM"];
  int checkIndex = 0;//当前选中索引

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: () {
        //输入框失焦
        FocusScope.of(context).requestFocus(FocusNode());
      },
      child: Scaffold(
        backgroundColor: YTStyle.bgColor,
        appBar: customAppBar(context, title: "已取消"),
        body: CustomScrollView(
          slivers: [
            //订单信息
            SliverToBoxAdapter(
              child: OrderInfo(),
            ),

            //联系方式
            SliverToBoxAdapter(
              child: Container(
                padding:
                EdgeInsets.only(bottom: setWidth(10), top: setWidth(10)),
                color: Colors.white,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceAround,
                  children: [
                    link(image: "blue_kefu.png",title: "在线联系",phone: "10086"),
                    link(image: "blue_phone_link.png",title: "电话联系",phone: "10086"),
                  ],
                ),
              ),
            ),

            //询价信息
            SliverToBoxAdapter(
              child: Container(
                margin: EdgeInsets.only(top: setWidth(15)),
                padding: EdgeInsets.only(
                    top: setWidth(18),
                    left: setWidth(15),
                    bottom: setWidth(13)),
                decoration: BoxDecoration(
                    color: Colors.white,
                    border: Border(
                        bottom: BorderSide(
                            color: Color(0xffF0F0F0), width: setWidth(0.5)))),
                child: Text(
                  "询价信息",
                  style: TextStyle(
                      color: Color(0xff323232),
                      fontSize: setSp(15),
                      fontWeight: FontWeight.w600),
                ),
              ),
            ),

            //询价列表
            SliverList(
                delegate: SliverChildBuilderDelegate(
                      (context, index) {
                    return EnquiryItem(
                      checkIndex: checkIndex,
                      onCheckUpdate: (value){
                        print(value);
                      },
                    );
                  },
                  childCount: typeList.length,
                )),
            //结算信息
            SliverToBoxAdapter(
              child: settlementInfo(price:"1259.00",serve: "3280.00",sum: "1259.00"),
            ),

            SliverToBoxAdapter(
              child: SizedBox(
                height: setWidth(50),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
